home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / write.man < prev   
Encoding:
Text File  |  1989-01-05  |  4.9 KB  |  199 lines

  1.  
  2.  
  3.  
  4. WRITE                 C Library Procedures                  WRITE
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      write, writev - write output
  10.  
  11. SSYYNNOOPPSSIISS
  12.      cccc == wwrriittee((dd,, bbuuff,, nnbbyytteess))
  13.      iinntt cccc,, dd;;
  14.      cchhaarr **bbuuff;;
  15.      iinntt nnbbyytteess;;
  16.  
  17.      ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
  18.      ##iinncclluuddee <<ssyyss//uuiioo..hh>>
  19.  
  20.      cccc == wwrriitteevv((dd,, iioovv,, iioovvccnntt))
  21.      iinntt cccc,, dd;;
  22.      ssttrruucctt iioovveecc **iioovv;;
  23.      iinntt iioovvccnntt;;
  24.  
  25. DDEESSCCRRIIPPTTIIOONN
  26.      _W_r_i_t_e attempts to write _n_b_y_t_e_s of data to the object refer-
  27.      enced by the descriptor _d from the buffer pointed to by _b_u_f.
  28.      _W_r_i_t_e_v performs the same action, but gathers the output data
  29.      from the _i_o_v_c_n_t buffers specified by the members of the _i_o_v
  30.      array: iov[0], iov[1], ..., iov[iovcnt-1].
  31.  
  32.      For _w_r_i_t_e_v, the _i_o_v_e_c structure is defined as
  33.  
  34.           struct iovec {
  35.                caddr_t   iov_base;
  36.                int  iov_len;
  37.           };
  38.  
  39.      Each _i_o_v_e_c entry specifies the base address and length of an
  40.      area in memory from which data should be written.  _W_r_i_t_e_v
  41.      will always write a complete area before proceeding to the
  42.      next.
  43.  
  44.      On objects capable of seeking, the _w_r_i_t_e starts at a posi-
  45.      tion given by the pointer associated with _d, see _l_s_e_e_k(2).
  46.      Upon return from _w_r_i_t_e, the pointer is incremented by the
  47.      number of bytes actually written.
  48.  
  49.      Objects that are not capable of seeking always write from
  50.      the current position.  The value of the pointer associated
  51.      with such an object is undefined.
  52.  
  53.      If the real user is not the super-user, then _w_r_i_t_e clears
  54.      the set-user-id bit on a file.  This prevents penetration of
  55.      system security by a user who "captures" a writable set-
  56.      user-id file owned by the super-user.
  57.  
  58.      When using non-blocking I/O on objects such as sockets that
  59.      are subject to flow control, _w_r_i_t_e and _w_r_i_t_e_v may write
  60.  
  61.  
  62.  
  63. Sprite v1.0               May 14, 1986                          1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. WRITE                 C Library Procedures                  WRITE
  71.  
  72.  
  73.  
  74.      fewer bytes than requested; the return value must be noted,
  75.      and the remainder of the operation should be retried when
  76.      possible.
  77.  
  78. RREETTUURRNN VVAALLUUEE
  79.      Upon successful completion the number of bytes actually
  80.      written is returned.  Otherwise a -1 is returned and the
  81.      global variable _e_r_r_n_o is set to indicate the error.
  82.  
  83. EERRRROORRSS
  84.      _W_r_i_t_e and _w_r_i_t_e_v will fail and the file pointer will remain
  85.      unchanged if one or more of the following are true:
  86.  
  87.      [EBADF]        _D is not a valid descriptor open for writing.
  88.  
  89.      [EPIPE]        An attempt is made to write to a pipe that is
  90.                     not open for reading by any process.
  91.  
  92.      [EPIPE]        An attempt is made to write to a socket of
  93.                     type SOCK_STREAM that is not connected to a
  94.                     peer socket.
  95.  
  96.      [EFBIG]        An attempt was made to write a file that
  97.                     exceeds the process's file size limit or the
  98.                     maximum file size.
  99.  
  100.      [EFAULT]       Part of _i_o_v or data to be written to the file
  101.                     points outside the process's allocated
  102.                     address space.
  103.  
  104.      [EINVAL]       The pointer associated with _d was negative.
  105.  
  106.      [ENOSPC]       There is no free space remaining on the file
  107.                     system containing the file.
  108.  
  109.      [EDQUOT]       The user's quota of disk blocks on the file
  110.                     system containing the file has been
  111.                     exhausted.
  112.  
  113.      [EIO]          An I/O error occurred while reading from or
  114.                     writing to the file system.
  115.  
  116.      [EWOULDBLOCK]  The file was marked for non-blocking I/O, and
  117.                     no data could be written immediately.
  118.  
  119.      In addition, _w_r_i_t_e_v may return one of the following errors:
  120.  
  121.      [EINVAL]       _I_o_v_c_n_t was less than or equal to 0, or
  122.                     greater than 16.
  123.  
  124.      [EINVAL]       One of the _i_o_v__l_e_n values in the _i_o_v array
  125.                     was negative.
  126.  
  127.  
  128.  
  129. Sprite v1.0               May 14, 1986                          2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. WRITE                 C Library Procedures                  WRITE
  137.  
  138.  
  139.  
  140.      [EINVAL]       The sum of the _i_o_v__l_e_n values in the _i_o_v
  141.                     array overflowed a 32-bit integer.
  142.  
  143. SSEEEE AALLSSOO
  144.      fcntl(2), lseek(2), open(2), pipe(2), select(2)
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. Sprite v1.0               May 14, 1986                          3
  196.  
  197.  
  198.  
  199.